﻿using Microsoft.Data.Objects;
using Model;

namespace Configuration.ModelConfiguration
{
    public class tkntProductConfiguration : EntityConfiguration<tkntProduct>
    {
        public tkntProductConfiguration()
        {
            Property(c => c.Id).IsIdentity();
            Property(c => c.IsHot);
            Property(c => c.Area).HasMaxLength(100).IsRequired();
            Property(c => c.ViDescription).HasMaxLength(4000).IsRequired();
            Property(c => c.EnDescription).HasMaxLength(4000).IsRequired();

            Property(c => c.ViInvestorName).HasMaxLength(200).IsRequired();
            Property(c => c.EnInvestorName).HasMaxLength(200).IsRequired();

            Property(c => c.ViInvestorDescription).HasMaxLength(4000).IsRequired();
            Property(c => c.EnInvestorDescription).HasMaxLength(4000).IsRequired();

            Relationship(c => c.Category).IsOptional();
            Relationship(c => c.Category).FromProperty(e => e.Products);

            Relationship(c => c.Images).IsOptional();
            Relationship(c => c.Images).FromProperty(e => e.Product);
        }
    }
}